UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Byfiw9uoJJJB2I2Q7dSMF7tNNeJv3dpryytA+45t1PM=' 
WHERE 
  key_id = '1de3ee151761ac641c90fc46898b428df754832276353e3fb2adf08908951fc9' 
  AND (
    token = 'Byfiw9uoJJJB2I2Q7dSMF7tNNeJv3dpryytA+45t1PM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024