UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JSvcxAfsJ3ypKQMm/ex5TtR8Ha5LtlYuuNvQonsIolY=' 
WHERE 
  key_id = 'e2478703f593294217563951d0217cd960500cd6b1598e68069950c55fc6b626' 
  AND (
    token = 'JSvcxAfsJ3ypKQMm/ex5TtR8Ha5LtlYuuNvQonsIolY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034