UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2yFNpzzCfG8JIbyJb5FblCDo2iFak+qkDPisVTz1irQ=' 
WHERE 
  key_id = '08e235c3d35e63c92b95fb1f8ff352522b627174c21730af480103181b991239' 
  AND (
    token = '2yFNpzzCfG8JIbyJb5FblCDo2iFak+qkDPisVTz1irQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052