UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p+8FLA8NBNqxmTvrzLhvXWlVB5geSepawRF89LA5StM=' 
WHERE 
  key_id = 'bed77536f028c0c8c2d58f5e59664eeec05eddb43cb76fe0d3870afcaeb2c685' 
  AND (
    token = 'p+8FLA8NBNqxmTvrzLhvXWlVB5geSepawRF89LA5StM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025