UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AincjDtdpudUQSeykLry84pPOFrVDT28Z8Kp7y+3RWc=' 
WHERE 
  key_id = '463cb8df95f1e1830dcf94b280e961154db4988ec1bdc54e8d2e90585c60b704' 
  AND (
    token = 'AincjDtdpudUQSeykLry84pPOFrVDT28Z8Kp7y+3RWc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026