UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4M7QiHNiLTD+a/GtzUcTcGU8alYlg1Lsyr4o761MkjA=' 
WHERE 
  key_id = 'bd7b8e9aa6c00d592a1a9f9c45617fdc350f70cb9aed6fd48efef8c780585301' 
  AND (
    token = '4M7QiHNiLTD+a/GtzUcTcGU8alYlg1Lsyr4o761MkjA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045