UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'feWL8fwu68mDh1CxzV2zj/8TOr1saxOJ3B8fjkj7+VI=' 
WHERE 
  key_id = '5d95a63d6903c19c1cbd8cabcada3bfec4d6baec3c085385622e4823a3b41a3a' 
  AND (
    token = 'feWL8fwu68mDh1CxzV2zj/8TOr1saxOJ3B8fjkj7+VI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023