UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xPG1IeWQRKJy7/khtWoFu7ODK18Hg/W4+vCV0Ah35dE=' 
WHERE 
  key_id = '716d984940b6be0ee081ddc65e3edc9370e08e127f79f5f178cedc70e7fafc93' 
  AND (
    token = 'xPG1IeWQRKJy7/khtWoFu7ODK18Hg/W4+vCV0Ah35dE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030