UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+plc3uRiC2EZts03VMpv1XTMHHifudgAJSyDW8E/it0=' 
WHERE 
  key_id = 'a5b7a5e42ebf9cfec40a2aaeb5180b04bf6c1e46894b05fc0e9e4715ab64f94d' 
  AND (
    token = '+plc3uRiC2EZts03VMpv1XTMHHifudgAJSyDW8E/it0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026