UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aQ7m5PCxKRpw4NwD5QGEhNbIWbNtNKLXMVKohf+h8Ok=' 
WHERE 
  key_id = '5110e3c154f0dcc97961c8bc3005e90cda29e43f44796f4019e5b47ff52c9634' 
  AND (
    token = 'aQ7m5PCxKRpw4NwD5QGEhNbIWbNtNKLXMVKohf+h8Ok=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034