UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GWBMk0ka04qfQdT6C6y1gvQVQVauHAeI/apH7NftxRI=' 
WHERE 
  key_id = 'bfc817dccb434b676822e899ca4184419f30b9d8e019ba0340b42d27bbc6bd1f' 
  AND (
    token = 'GWBMk0ka04qfQdT6C6y1gvQVQVauHAeI/apH7NftxRI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029