UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cYkGsS1MYDdJdWOq9qgQaBMujU171BPA08lEl3m18Cg=' 
WHERE 
  key_id = '14b5112ba930197aa058ea01e694c790b81911f5b716c7c7f630bd0cd6425878' 
  AND (
    token = 'cYkGsS1MYDdJdWOq9qgQaBMujU171BPA08lEl3m18Cg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026