UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y2TJaTHVxENtgJooXmT0331WCefE5Xr1LMZMOG8l/xY=' 
WHERE 
  key_id = '6a5351c86cacaa3003593c09054e07330ad21d4cfebe1005e109c52da4c35718' 
  AND (
    token = 'Y2TJaTHVxENtgJooXmT0331WCefE5Xr1LMZMOG8l/xY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040