UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YihSn6etTQU19Gi3UgTzsyEx8Q/tggpvRTU1wCjASlg=' 
WHERE 
  key_id = '4d0f04b76bf7a35a584dc26776d879afade3dddc2c2189560c46e37a12e4eaac' 
  AND (
    token = 'YihSn6etTQU19Gi3UgTzsyEx8Q/tggpvRTU1wCjASlg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032