UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BKIuDjIXRqWqAopgigKr+3IaCfRGI0erEl7iP4Ily4g=' 
WHERE 
  key_id = '3a1c425584e91d7f2d2b3aa355aff4c7d3c6d80ad74fbbc44e01d7e6fe9e08f2' 
  AND (
    token = 'BKIuDjIXRqWqAopgigKr+3IaCfRGI0erEl7iP4Ily4g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040