UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'z2sdRveLNolE+3uAafLNeqOttK3fBE9MFnQo1GwperE=' 
WHERE 
  key_id = '779bbd1f253e7e121b361d20df7a19ffd6a2bd507079e4931644fa2b427458a3' 
  AND (
    token = 'z2sdRveLNolE+3uAafLNeqOttK3fBE9MFnQo1GwperE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039