UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oBqP/1E5YeY3Dcd7FLe9jrM+bT49N1DdAK8QxtF/6Ec=' 
WHERE 
  key_id = '645e676aecc9579a0a99258008fd4b7e3c371a75394d7783a3f79eab599742bd' 
  AND (
    token = 'oBqP/1E5YeY3Dcd7FLe9jrM+bT49N1DdAK8QxtF/6Ec=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021