UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HYSIpSH3reQNdxL7LfU+gGqcEQPDSP6bQbL1qnWvHOA=' 
WHERE 
  key_id = 'b1d3faee59f086d2f04909f1527e9bccb73da099c9539f6d06edf6fada736f76' 
  AND (
    token = 'HYSIpSH3reQNdxL7LfU+gGqcEQPDSP6bQbL1qnWvHOA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032