UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zaMbb5bC4DJVJzbX2M1FpMucwi8VShWk74zPG7i2W+Q=' 
WHERE 
  key_id = '121195a0a909a74817a2a2a7f6f9fec09d0b58ce3f9c37ce8de97eff6ae4757e' 
  AND (
    token = 'zaMbb5bC4DJVJzbX2M1FpMucwi8VShWk74zPG7i2W+Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025