UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MDq0J7JNakXqXRMhUdMBvXYmCOQOLlnM81B6d0qSo+4=' 
WHERE 
  key_id = 'ed67002c0ddc452885da308e6b61b30813281bde2d22f332831a8ade695b1c98' 
  AND (
    token = 'MDq0J7JNakXqXRMhUdMBvXYmCOQOLlnM81B6d0qSo+4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038