UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yJFDyqVvgEvmGiy9WoBV0vzZmXQTTetCeRzPlvnWN2Q=' 
WHERE 
  key_id = '447ff6f77800b6d49f5292da8558e9790e3d3078d45aa92b6084368b55546387' 
  AND (
    token = 'yJFDyqVvgEvmGiy9WoBV0vzZmXQTTetCeRzPlvnWN2Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00084