UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aiZFHjgX3Loz0jVJLpq0ogK6xfndoWu9kPqGmcfe9Xw=' 
WHERE 
  key_id = '4423cad0707237adf60158c947bf2f87198b9b98460d0b35fd02ee839fc0a21e' 
  AND (
    token = 'aiZFHjgX3Loz0jVJLpq0ogK6xfndoWu9kPqGmcfe9Xw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040