UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'j0a0Cb3WJGud3UrZSn5MTUYYcRuVuEE7R5mL0Hrmm1A=' 
WHERE 
  key_id = '6571c7844b943ba30ea4055bddaa9900fe06ef660081f0d11cd062ea4499c03c' 
  AND (
    token = 'j0a0Cb3WJGud3UrZSn5MTUYYcRuVuEE7R5mL0Hrmm1A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048