UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a2Uu6Qj82sgYQQYmLqN3cf46F4BfictulNO1yPduVik=' 
WHERE 
  key_id = '58761dfaea7b24ff12153cc461a77a1554f5df01e70f399cda00b11f1a99a32c' 
  AND (
    token = 'a2Uu6Qj82sgYQQYmLqN3cf46F4BfictulNO1yPduVik=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042