UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3cgX87pNSPPJia+AlHlHclIyXRPitYqBkUVNnqcQh5s=' 
WHERE 
  key_id = '7760bce5d0d77eec4dec91617dae2bbfded8b02195d297efb2f537f3b85c719b' 
  AND (
    token = '3cgX87pNSPPJia+AlHlHclIyXRPitYqBkUVNnqcQh5s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00279