UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lzviAiJQX/Ngzg5I2Z15cCY2UklM9nOkRJyrt9DfviY=' 
WHERE 
  key_id = 'a52436580312fb6d227dea777d278a54aebfc8bbe337c0d489c14faa01b82783' 
  AND (
    token = 'lzviAiJQX/Ngzg5I2Z15cCY2UklM9nOkRJyrt9DfviY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059