UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hXagsD4e52r83LYYT15mGukw/hEzhrx0uv/77M+6XPE=' 
WHERE 
  key_id = '28fb8ac48616dc63e4d203d0f45e0337b6b92d5e0390062829945bcaf252435e' 
  AND (
    token = 'hXagsD4e52r83LYYT15mGukw/hEzhrx0uv/77M+6XPE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.01040