UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6aU9iJi2lTTI2BsDF4utakizj5BN6Ha+Lq8xwz8ARaI=' 
WHERE 
  key_id = '6a6264df5573f96afe64c66631e542604c984bb15d8a1930d68cc257d357aaf2' 
  AND (
    token = '6aU9iJi2lTTI2BsDF4utakizj5BN6Ha+Lq8xwz8ARaI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037